Compiler Design


Q81.

Consider the following grammar S \rightarrow F|H F \rightarrow p|c H \rightarrow d|c where S,F, and H are non-terminal symbols, p,d, and c are terminal symbols. Which of the following statement(s) is/are correct? S1. LL(1) can parse all strings that are generated using grammar G S2. LR(1) can parse all strings that are generated using grammar G
GateOverflow

Q82.

Consider the grammar defined by the following production rules, with two operators * and + S \rightarrowT *P T \rightarrowU| T*U P \rightarrow Q +P |Q Q \rightarrow Id U \rightarrow Id Which one of the following is TRUE?
GateOverflow

Q83.

A canonical set of items is given below S\rightarrow L. \gt R Q\rightarrowR. On input symbol \lt the set has
GateOverflow

Q84.

Which of the following productions eliminate left recursion in the productions given below: S \rightarrow Aa \mid b A \rightarrow Ac \mid Sd \mid \epsilon
GateOverflow

Q85.

Consider the following two sets of LR(1) items of an LR(1) grammar. \begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕  d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array} Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE? 1. Cannot be merged since look aheads are different. 2. Can be merged but will result in S-R conflict. 3. Can be merged but will result in R-R conflict. 4. Cannot be merged since goto on c will lead to two different sets.
GateOverflow

Q86.

Shift reduce parsing belongs to a class of
GateOverflow

Q87.

What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A\rightarrow \epsilon and A \rightarrow a ) to parse a string with n tokens?
GateOverflow

Q88.

Which of the following sentences can be generated by S -> aS \mid bA A -> d \mid cA
GateOverflow

Q89.

Consider two binary operators '\uparrow 'and '\downarrow' with the precedence of operator \downarrow being lower than that of the operator \uparrow . Operator \uparrow is right associative while operator \downarrow is left associative. Which one of the following represents the parse tree for expression (7 \downarrow 3 \uparrow4 \uparrow 3 \downarrow2)?
GateOverflow

Q90.

Which variable does not drive a terminal string in grammar? S -> AB A -> a B -> b B -> C
GateOverflow